package com.smile.ye.data.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.*;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName( value = "smile_cart_order",autoResultMap = true)
public class CartOrderEntity {
    @TableId(type = IdType.ASSIGN_ID)
    String id;

    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<CartDetailEntity> products;

    String status;

    @TableField("totalCount")
    Integer totalCount;

    @TableField("totalAmount")
    Integer totalAmount;

    @TableField("totalReduce")
    Integer totalReduce;

    @TableField(value = "createdAt",fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    LocalDateTime createdAt;

    @TableField(value = "updatedAt",fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    LocalDateTime updatedAt;

}
